package 多线程.线程状态.sleep和yield和join;


/**
 * join
 *
 * t线程执行完才执行main
 */
public class Join {
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            for (int i = 0; i < 100; i++) {
                System.out.println("没素质插队");
            }
        });
        t1.start();
        for (int i = 0; i < 100; i++) {
            if (i == 10) {
                t1.join();//插队,main被挡住
            }
            System.out.println("排队老实人");
        }
    }
}
